﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySoft.Data;

namespace Caifu.Pres.Datas
{
	public class PreNetValueCheckData
	{
		/// <summary>
		/// 
		/// </summary>
		public static readonly PreNetValueCheckData Instance = new PreNetValueCheckData();

		private readonly DbSession dbSession = new DbSession("Caifu.Pres");

		public void Add(PreNetValueCheck item)
		{
			item.Detach();
			item.Id = Guid.NewGuid();
			item.AddTime = DateTime.Now;
			item.UpdateTime = DateTime.Now;

			dbSession.Save(item);
		}

		public void Update(PreNetValueCheck item)
		{
			item.Attach();
			item.UpdateTime = DateTime.Now;

			dbSession.Save(item);
		}

		public IList<PreNetValueCheck> List(DateTime reportDate)
		{
			return dbSession.From<PreNetValueCheck>()
				.Where(PreNetValueCheck._.ReportDate == reportDate)
				.ToList();
		}
	}
}
